


***0209 former ones crecs_  new ccrecs_






clear 
use crecs_1993

drop gincome ggincome hhfaminc_1990 _merge

gen gincome=runiform(0,3000) if moneypy==1
replace gincome=runiform(3000,3999) if moneypy==2
replace gincome=runiform(4000,4999) if moneypy==3
replace gincome=runiform(5000,5999) if moneypy==4
replace gincome=runiform(6000,7499) if moneypy==5

replace gincome=runiform(7500,8999) if moneypy==6
replace gincome=runiform(9000,9999) if moneypy==7
replace gincome=runiform(10000,10999) if moneypy==8
replace gincome=runiform(11000,12499) if moneypy==9
replace gincome=runiform(12500,13999) if moneypy==10
replace gincome=runiform(14000,14999) if moneypy==11
replace gincome=runiform(15000,17499) if moneypy==12
replace gincome=runiform(17500,19999) if moneypy==13
replace gincome=runiform(20000,22499) if moneypy==14
replace gincome=runiform(22500,24999) if moneypy==15

replace gincome=runiform(25000,27499) if moneypy==16
replace gincome=runiform(27500,29999) if moneypy==17
replace gincome=runiform(30000,32499) if moneypy==18
replace gincome=runiform(32500,34999) if moneypy==19
replace gincome=runiform(35000,39999) if moneypy==20
replace gincome=runiform(40000,44999) if moneypy==21
replace gincome=runiform(45000,49999) if moneypy==22
replace gincome=runiform(50000,74999) if moneypy==23
replace gincome=runiform(75000,99999) if moneypy==24
replace gincome=runiform(100000,200000) if moneypy==25

merge m:1 year using cpi_allyears_2.dta
keep if _merge==3
gen ggincome=gincome*cpi_1990

gen hhfaminc_1990 = 1 if ggincome<3000
	replace hhfaminc_1990 = 2 if ggincome>=3000 & ggincome<4000
	replace hhfaminc_1990 = 3 if ggincome>=4000 & ggincome<5000
	replace hhfaminc_1990 = 4 if ggincome>=5000 & ggincome<6000
	replace hhfaminc_1990 = 5 if ggincome>=6000 & ggincome<7500
	replace hhfaminc_1990 = 7 if ggincome>=7500 & ggincome<9000
	replace hhfaminc_1990 = 8 if ggincome>=9000 & ggincome<10000
	replace hhfaminc_1990 = 9 if ggincome>=10000 & ggincome<11000
	replace hhfaminc_1990 = 10 if ggincome>=11000 & ggincome<12500
	replace hhfaminc_1990 = 12 if ggincome>=12500 & ggincome<14000
	replace hhfaminc_1990 = 13 if ggincome>=14000 & ggincome<15000
	replace hhfaminc_1990 = 14 if ggincome>=15000 & ggincome<17500
	replace hhfaminc_1990 = 15 if ggincome>=17500 & ggincome<20000
	replace hhfaminc_1990 = 16 if ggincome>=20000 & ggincome<22500
	replace hhfaminc_1990 = 17 if ggincome>=22500 & ggincome<25000
	replace hhfaminc_1990 = 18 if ggincome>=25000 & ggincome<27500
	replace hhfaminc_1990 = 19 if ggincome>=27500 & ggincome<30000
	replace hhfaminc_1990 = 20 if ggincome>=30000 & ggincome<32500
	replace hhfaminc_1990 = 21  if ggincome>=32500 & ggincome<35000
	replace hhfaminc_1990 = 22 if ggincome>=35000 & ggincome<40000
	replace hhfaminc_1990 = 23 if ggincome>=40000 & ggincome<50000
	replace hhfaminc_1990 = 24 if ggincome>=50000 & ggincome<75000
	replace hhfaminc_1990 = 25 if ggincome>=75000 & ggincome!=.

save ccrecs_1993.dta,replace


**1997


clear 
use crecs_1997

drop gincome ggincome hhfaminc_1990 _merge

gen gincome=runiform(0,3000) if moneypy==1
replace gincome=runiform(3000,3999) if moneypy==2
replace gincome=runiform(4000,4999) if moneypy==3
replace gincome=runiform(5000,5999) if moneypy==4
replace gincome=runiform(6000,7499) if moneypy==5

replace gincome=runiform(7500,8999) if moneypy==6
replace gincome=runiform(9000,9999) if moneypy==7
replace gincome=runiform(10000,10999) if moneypy==8
replace gincome=runiform(11000,12499) if moneypy==9
replace gincome=runiform(12500,13999) if moneypy==10
replace gincome=runiform(14000,14999) if moneypy==11
replace gincome=runiform(15000,17499) if moneypy==12
replace gincome=runiform(17500,19999) if moneypy==13
replace gincome=runiform(20000,22499) if moneypy==14
replace gincome=runiform(22500,24999) if moneypy==15

replace gincome=runiform(25000,27499) if moneypy==16
replace gincome=runiform(27500,29999) if moneypy==17
replace gincome=runiform(30000,32499) if moneypy==18
replace gincome=runiform(32500,34999) if moneypy==19
replace gincome=runiform(35000,39999) if moneypy==20
replace gincome=runiform(40000,44999) if moneypy==21
replace gincome=runiform(45000,49999) if moneypy==22
replace gincome=runiform(50000,74999) if moneypy==23
replace gincome=runiform(75000,99999) if moneypy==24
replace gincome=runiform(100000,200000) if moneypy==25




merge m:1 year using cpi_allyears_2.dta
keep if _merge==3
gen ggincome=gincome*cpi_1990

gen hhfaminc_1990 = 1 if ggincome<3000
	replace hhfaminc_1990 = 2 if ggincome>=3000 & ggincome<4000
	replace hhfaminc_1990 = 3 if ggincome>=4000 & ggincome<5000
	replace hhfaminc_1990 = 4 if ggincome>=5000 & ggincome<6000
	replace hhfaminc_1990 = 5 if ggincome>=6000 & ggincome<7500
	replace hhfaminc_1990 = 7 if ggincome>=7500 & ggincome<9000
	replace hhfaminc_1990 = 8 if ggincome>=9000 & ggincome<10000
	replace hhfaminc_1990 = 9 if ggincome>=10000 & ggincome<11000
	replace hhfaminc_1990 = 10 if ggincome>=11000 & ggincome<12500
	replace hhfaminc_1990 = 12 if ggincome>=12500 & ggincome<14000
	replace hhfaminc_1990 = 13 if ggincome>=14000 & ggincome<15000
	replace hhfaminc_1990 = 14 if ggincome>=15000 & ggincome<17500
	replace hhfaminc_1990 = 15 if ggincome>=17500 & ggincome<20000
	replace hhfaminc_1990 = 16 if ggincome>=20000 & ggincome<22500
	replace hhfaminc_1990 = 17 if ggincome>=22500 & ggincome<25000
	replace hhfaminc_1990 = 18 if ggincome>=25000 & ggincome<27500
	replace hhfaminc_1990 = 19 if ggincome>=27500 & ggincome<30000
	replace hhfaminc_1990 = 20 if ggincome>=30000 & ggincome<32500
	replace hhfaminc_1990 = 21  if ggincome>=32500 & ggincome<35000
	replace hhfaminc_1990 = 22 if ggincome>=35000 & ggincome<40000
	replace hhfaminc_1990 = 23 if ggincome>=40000 & ggincome<50000
	replace hhfaminc_1990 = 24 if ggincome>=50000 & ggincome<75000
	replace hhfaminc_1990 = 25 if ggincome>=75000 & ggincome!=.

save ccrecs_1997.dta,replace

**2001
use crecs_2001.dta,clear

gen gincome=runiform(0,5000) if moneypy==1
replace gincome=runiform(5000,9999) if moneypy==2
replace gincome=runiform(10000,14999) if moneypy==3
replace gincome=runiform(15000,19999) if moneypy==4
replace gincome=runiform(20000,29999) if moneypy==5
replace gincome=runiform(30000,39999) if moneypy==6
replace gincome=runiform(40000,49999) if moneypy==7
replace gincome=runiform(50000,74999) if moneypy==8
replace gincome=runiform(75000,99999) if moneypy==9
replace gincome=runiform(100000,200000) if moneypy==10


merge m:1 year using cpi_allyears_2.dta
keep if _merge==3
gen ggincome=gincome*cpi_1990

gen hhfaminc_1990 = 1 if ggincome<3000
	replace hhfaminc_1990 = 2 if ggincome>=3000 & ggincome<4000
	replace hhfaminc_1990 = 3 if ggincome>=4000 & ggincome<5000
	replace hhfaminc_1990 = 4 if ggincome>=5000 & ggincome<6000
	replace hhfaminc_1990 = 5 if ggincome>=6000 & ggincome<7500
	replace hhfaminc_1990 = 7 if ggincome>=7500 & ggincome<9000
	replace hhfaminc_1990 = 8 if ggincome>=9000 & ggincome<10000
	replace hhfaminc_1990 = 9 if ggincome>=10000 & ggincome<11000
	replace hhfaminc_1990 = 10 if ggincome>=11000 & ggincome<12500
	replace hhfaminc_1990 = 12 if ggincome>=12500 & ggincome<14000
	replace hhfaminc_1990 = 13 if ggincome>=14000 & ggincome<15000
	replace hhfaminc_1990 = 14 if ggincome>=15000 & ggincome<17500
	replace hhfaminc_1990 = 15 if ggincome>=17500 & ggincome<20000
	replace hhfaminc_1990 = 16 if ggincome>=20000 & ggincome<22500
	replace hhfaminc_1990 = 17 if ggincome>=22500 & ggincome<25000
	replace hhfaminc_1990 = 18 if ggincome>=25000 & ggincome<27500
	replace hhfaminc_1990 = 19 if ggincome>=27500 & ggincome<30000
	replace hhfaminc_1990 = 20 if ggincome>=30000 & ggincome<32500
	replace hhfaminc_1990 = 21  if ggincome>=32500 & ggincome<35000
	replace hhfaminc_1990 = 22 if ggincome>=35000 & ggincome<40000
	replace hhfaminc_1990 = 23 if ggincome>=40000 & ggincome<50000
	replace hhfaminc_1990 = 24 if ggincome>=50000 & ggincome<75000
	replace hhfaminc_1990 = 25 if ggincome>=75000 & ggincome!=.

save ccrecs_2001.dta,replace

**2005
use crecs_2005.dta,clear

gen gincome=runiform(0,2500) if moneypy==1
replace gincome=runiform(2500,4999) if moneypy==2
replace gincome=runiform(5000,7499) if moneypy==3
replace gincome=runiform(7500,9999) if moneypy==4
replace gincome=runiform(10000,14999) if moneypy==5
replace gincome=runiform(15000,19999) if moneypy==6
replace gincome=runiform(20000,24999) if moneypy==7
replace gincome=runiform(25000,29999) if moneypy==8
replace gincome=runiform(30000,34999) if moneypy==9
replace gincome=runiform(35000,39999) if moneypy==10
replace gincome=runiform(40000,44999) if moneypy==11
replace gincome=runiform(45000,49999) if moneypy==12
replace gincome=runiform(50000,54999) if moneypy==13
replace gincome=runiform(55000,59999) if moneypy==14
replace gincome=runiform(60000,64999) if moneypy==15
replace gincome=runiform(65000,69999) if moneypy==16
replace gincome=runiform(70000,74999) if moneypy==17
replace gincome=runiform(75000,79999) if moneypy==18
replace gincome=runiform(80000,84999) if moneypy==19
replace gincome=runiform(85000,89999) if moneypy==20
replace gincome=runiform(90000,94999) if moneypy==21
replace gincome=runiform(95000,99999) if moneypy==22
replace gincome=runiform(100000,119999) if moneypy==23
replace gincome=runiform(120000,240000) if moneypy==24


merge m:1 year using cpi_allyears_2.dta
keep if _merge==3
gen ggincome=gincome*cpi_1990

gen hhfaminc_1990 = 1 if ggincome<3000
	replace hhfaminc_1990 = 2 if ggincome>=3000 & ggincome<4000
	replace hhfaminc_1990 = 3 if ggincome>=4000 & ggincome<5000
	replace hhfaminc_1990 = 4 if ggincome>=5000 & ggincome<6000
	replace hhfaminc_1990 = 5 if ggincome>=6000 & ggincome<7500
	replace hhfaminc_1990 = 7 if ggincome>=7500 & ggincome<9000
	replace hhfaminc_1990 = 8 if ggincome>=9000 & ggincome<10000
	replace hhfaminc_1990 = 9 if ggincome>=10000 & ggincome<11000
	replace hhfaminc_1990 = 10 if ggincome>=11000 & ggincome<12500
	replace hhfaminc_1990 = 12 if ggincome>=12500 & ggincome<14000
	replace hhfaminc_1990 = 13 if ggincome>=14000 & ggincome<15000
	replace hhfaminc_1990 = 14 if ggincome>=15000 & ggincome<17500
	replace hhfaminc_1990 = 15 if ggincome>=17500 & ggincome<20000
	replace hhfaminc_1990 = 16 if ggincome>=20000 & ggincome<22500
	replace hhfaminc_1990 = 17 if ggincome>=22500 & ggincome<25000
	replace hhfaminc_1990 = 18 if ggincome>=25000 & ggincome<27500
	replace hhfaminc_1990 = 19 if ggincome>=27500 & ggincome<30000
	replace hhfaminc_1990 = 20 if ggincome>=30000 & ggincome<32500
	replace hhfaminc_1990 = 21  if ggincome>=32500 & ggincome<35000
	replace hhfaminc_1990 = 22 if ggincome>=35000 & ggincome<40000
	replace hhfaminc_1990 = 23 if ggincome>=40000 & ggincome<50000
	replace hhfaminc_1990 = 24 if ggincome>=50000 & ggincome<75000
	replace hhfaminc_1990 = 25 if ggincome>=75000 & ggincome!=.

save ccrecs_2005.dta,replace


**2009
use crecs_2009.dta,clear

gen gincome=runiform(0,2500) if moneypy==1
replace gincome=runiform(2500,4999) if moneypy==2
replace gincome=runiform(5000,7499) if moneypy==3
replace gincome=runiform(7500,9999) if moneypy==4
replace gincome=runiform(10000,14999) if moneypy==5
replace gincome=runiform(15000,19999) if moneypy==6
replace gincome=runiform(20000,24999) if moneypy==7
replace gincome=runiform(25000,29999) if moneypy==8
replace gincome=runiform(30000,34999) if moneypy==9
replace gincome=runiform(35000,39999) if moneypy==10
replace gincome=runiform(40000,44999) if moneypy==11
replace gincome=runiform(45000,49999) if moneypy==12
replace gincome=runiform(50000,54999) if moneypy==13
replace gincome=runiform(55000,59999) if moneypy==14
replace gincome=runiform(60000,64999) if moneypy==15
replace gincome=runiform(65000,69999) if moneypy==16
replace gincome=runiform(70000,74999) if moneypy==17
replace gincome=runiform(75000,79999) if moneypy==18
replace gincome=runiform(80000,84999) if moneypy==19
replace gincome=runiform(85000,89999) if moneypy==20
replace gincome=runiform(90000,94999) if moneypy==21
replace gincome=runiform(95000,99999) if moneypy==22
replace gincome=runiform(100000,119999) if moneypy==23
replace gincome=runiform(120000,240000) if moneypy==24


merge m:1 year using cpi_allyears_2.dta
keep if _merge==3
gen ggincome=gincome*cpi_1990

gen hhfaminc_1990 = 1 if ggincome<3000
	replace hhfaminc_1990 = 2 if ggincome>=3000 & ggincome<4000
	replace hhfaminc_1990 = 3 if ggincome>=4000 & ggincome<5000
	replace hhfaminc_1990 = 4 if ggincome>=5000 & ggincome<6000
	replace hhfaminc_1990 = 5 if ggincome>=6000 & ggincome<7500
	replace hhfaminc_1990 = 7 if ggincome>=7500 & ggincome<9000
	replace hhfaminc_1990 = 8 if ggincome>=9000 & ggincome<10000
	replace hhfaminc_1990 = 9 if ggincome>=10000 & ggincome<11000
	replace hhfaminc_1990 = 10 if ggincome>=11000 & ggincome<12500
	replace hhfaminc_1990 = 12 if ggincome>=12500 & ggincome<14000
	replace hhfaminc_1990 = 13 if ggincome>=14000 & ggincome<15000
	replace hhfaminc_1990 = 14 if ggincome>=15000 & ggincome<17500
	replace hhfaminc_1990 = 15 if ggincome>=17500 & ggincome<20000
	replace hhfaminc_1990 = 16 if ggincome>=20000 & ggincome<22500
	replace hhfaminc_1990 = 17 if ggincome>=22500 & ggincome<25000
	replace hhfaminc_1990 = 18 if ggincome>=25000 & ggincome<27500
	replace hhfaminc_1990 = 19 if ggincome>=27500 & ggincome<30000
	replace hhfaminc_1990 = 20 if ggincome>=30000 & ggincome<32500
	replace hhfaminc_1990 = 21  if ggincome>=32500 & ggincome<35000
	replace hhfaminc_1990 = 22 if ggincome>=35000 & ggincome<40000
	replace hhfaminc_1990 = 23 if ggincome>=40000 & ggincome<50000
	replace hhfaminc_1990 = 24 if ggincome>=50000 & ggincome<75000
	replace hhfaminc_1990 = 25 if ggincome>=75000 & ggincome!=.

save ccrecs_2009.dta,replace

** 2015
use crecs_2015.dta,replace

gen gincome=runiform(0,20000) if moneypy==1
replace gincome=runiform(20000,39999) if moneypy==2
replace gincome=runiform(40000,59999) if moneypy==3
replace gincome=runiform(60000,79999) if moneypy==4
replace gincome=runiform(80000,99999) if moneypy==5
replace gincome=runiform(100000,119999) if moneypy==6
replace gincome=runiform(120000,139999) if moneypy==7
replace gincome=runiform(140000,280000) if moneypy==8

merge m:1 year using cpi_allyears_2.dta
keep if _merge==3
gen ggincome=gincome*cpi_1990

gen hhfaminc_1990 = 1 if ggincome<3000
	replace hhfaminc_1990 = 2 if ggincome>=3000 & ggincome<4000
	replace hhfaminc_1990 = 3 if ggincome>=4000 & ggincome<5000
	replace hhfaminc_1990 = 4 if ggincome>=5000 & ggincome<6000
	replace hhfaminc_1990 = 5 if ggincome>=6000 & ggincome<7500
	replace hhfaminc_1990 = 7 if ggincome>=7500 & ggincome<9000
	replace hhfaminc_1990 = 8 if ggincome>=9000 & ggincome<10000
	replace hhfaminc_1990 = 9 if ggincome>=10000 & ggincome<11000
	replace hhfaminc_1990 = 10 if ggincome>=11000 & ggincome<12500
	replace hhfaminc_1990 = 12 if ggincome>=12500 & ggincome<14000
	replace hhfaminc_1990 = 13 if ggincome>=14000 & ggincome<15000
	replace hhfaminc_1990 = 14 if ggincome>=15000 & ggincome<17500
	replace hhfaminc_1990 = 15 if ggincome>=17500 & ggincome<20000
	replace hhfaminc_1990 = 16 if ggincome>=20000 & ggincome<22500
	replace hhfaminc_1990 = 17 if ggincome>=22500 & ggincome<25000
	replace hhfaminc_1990 = 18 if ggincome>=25000 & ggincome<27500
	replace hhfaminc_1990 = 19 if ggincome>=27500 & ggincome<30000
	replace hhfaminc_1990 = 20 if ggincome>=30000 & ggincome<32500
	replace hhfaminc_1990 = 21  if ggincome>=32500 & ggincome<35000
	replace hhfaminc_1990 = 22 if ggincome>=35000 & ggincome<40000
	replace hhfaminc_1990 = 23 if ggincome>=40000 & ggincome<50000
	replace hhfaminc_1990 = 24 if ggincome>=50000 & ggincome<75000
	replace hhfaminc_1990 = 25 if ggincome>=75000 & ggincome!=.

save ccrecs_2015.dta,replace




*** 1990

clear 
use crecs_1990

	  
gen gincome=runiform(0,3000) if moneypy==1
replace gincome=runiform(3000,3999) if moneypy==2
replace gincome=runiform(4000,4999) if moneypy==3
replace gincome=runiform(5000,5999) if moneypy==4
replace gincome=runiform(6000,7499) if moneypy==5
replace gincome=runiform(7500,8999) if moneypy==7
replace gincome=runiform(9000,9999) if moneypy==8
replace gincome=runiform(10000,10999) if moneypy==9
replace gincome=runiform(11000,12499) if moneypy==10
replace gincome=runiform(12500,13999) if moneypy==12
replace gincome=runiform(14000,14999) if moneypy==13
replace gincome=runiform(15000,17499) if moneypy==14
replace gincome=runiform(17500,19999) if moneypy==15
replace gincome=runiform(20000,22499) if moneypy==16
replace gincome=runiform(22500,24999) if moneypy==17

replace gincome=runiform(25000,27499) if moneypy==18
replace gincome=runiform(27500,29999) if moneypy==19
replace gincome=runiform(30000,32499) if moneypy==20
replace gincome=runiform(32500,34999) if moneypy==21
replace gincome=runiform(35000,39999) if moneypy==22
replace gincome=runiform(40000,49999) if moneypy==23

replace gincome=runiform(50000,74999) if moneypy==24
replace gincome=runiform(75000,150000) if moneypy==25

 gen hhfaminc_1990=moneypy
 rename gincome ggincome

save ccrecs_1990.dta,replace



